/**
 * @file 	drv_uart.h
 * @brief   uart驱动
 * @author 	Liuwei
 * @version 1.0.1
 * @date 	2023-04-18
 * 
 * @copyright Copyright (c) 2023 JBD-Energy Storage Technology Co. LTD
 * 
 * @par 修改日志:
 * <table>
 * <tr><th>Date       <th>Version   <th>Author   <th>Description
 * <tr><td>2023-04-18 <td>1.0.1     <td>LiuWei   <td>首次创建
 * </table>
 */

#ifndef __DRV_UART_H_
#define __DRV_UART_H_

/* File Includes -------------------------------------------------------------*/
#include <stdint.h>
#include "FreeRTOS.h"
#include "task.h"
/* Cplusplus -----------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif

/* Macro/Define/Typedef ------------------------------------------------------*/
enum
{
	DRV_UART0 , 
	DRV_UART1 ,
	DRV_UART2 ,
	DRV_UART3 ,
	DRV_UART4 ,
	DRV_UART5 ,
	DRV_UART6 ,
	DRV_UART7 ,

	DRV_UART_MAX ,
};

typedef void (*uart_rx_cb_func)(uint8_t , uint8_t);

#define uart_delay_ms   vTaskDelay
//#define uart_delay_ms   mcu_delay_ms 
/* @brief */

/* Variables -----------------------------------------------------------------*/

/*******************************************************************************
 * public API List
 ******************************************************************************/
void drv_uart_init(uint8_t uart_id , uint32_t baudrate);
void drv_uart_set_rx_cb(uint8_t uart_id , uart_rx_cb_func pfunc);
void drv_uart_send_str(uint8_t uart_id ,uint8_t *sbuf ,uint32_t send_num);
void drv_uart0_recv_irq(uint8_t rx_data);
void drv_uart1_recv_irq(uint8_t rx_data);
void drv_uart2_recv_irq(uint8_t rx_data);
void drv_uart3_recv_irq(uint8_t rx_data);
void drv_uart4_recv_irq(uint8_t rx_data);
void drv_uart5_recv_irq(uint8_t rx_data);
void drv_uart6_recv_irq(uint8_t rx_data);
void drv_uart7_recv_irq(uint8_t rx_data);
void drv_uart_deinit(uint8_t uart_id);
void drv_uart_send_char(uint8_t uart_id ,uint8_t byte);

#ifdef __cplusplus
}
#endif

#endif  /* #ifndef __DRV_UART_H_ */
/********** Copyright (c) 2023 JBD-Energy Storage Technology Co. LTD *********/
